package com.eonmind.pay.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

@AllArgsConstructor
@Getter
@ToString
public enum PayWayType {

    WEIXIN("微信支付", 1),
    ALIPAY("支付宝支付", 2);

    private final String type;

    private final Integer code;

    //根据code返回type
    public static String getTypeByCode(Integer code) {
        for (PayWayType payWay : PayWayType.values()) {
            if (payWay.getCode().equals(code)) {
                return payWay.getType();
            }
        }
        return null;
    }

}
